package com.ok;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.time.LocalDateTime;
import java.util.concurrent.ThreadPoolExecutor;

public class App {
    public static void main(String[] args) {
        ApplicationContext context = new AnnotationConfigApplicationContext(Config.class);
        ThreadPoolExecutor threadPoolExecutor = (ThreadPoolExecutor) context.getBean("executor");
        threadPoolExecutor.execute(() -> {
            while(  true ){
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                System.out.println(LocalDateTime.now());
            }
        });
    }
}
